<!DOCTYPE html>
<html>

<head>
    <meta name="layout" content="main2" />
    <title>团队的商机</title>
</head>

<body>
    <div class="main-body">
        <div class="page-wrapper">
            <!-- Page-header start -->
            <div class="page-header">
                <div class="page-header-title">
                    <h4>团队的商机</h4>
                </div>

                <div class="page-header-breadcrumb">
                    <ul class="breadcrumb-title">
                        <li class="breadcrumb-item">
                            <a href="/salesDashboard/index">
                                <i class="icofont icofont-home"></i>
                            </a>
                        </li>
                        <li class="breadcrumb-item"><a href="#!">团队的商机</a>
                        </li>
                    </ul>
                </div>
            </div>
            <div class="page-body">
                <div class="card">
                    <div class="card-header">
                        <h5>团队的商机</h5>

                        <div class="card-header-right">
                        </div>
                    </div>

                    <div class="card-block dt-responsive">

                        <div class="table-responsive">
                            <div id="dom-jqry_wrapper" class="dataTables_wrapper dt-bootstrap4">

                                <g:form method="POST" action="searchOpportunityTeam">
                                    <div class="row m-0">
                                        <div class="col-md-8 p-l-0">
                                            <div id="order-table_filter" class="dataTables_filter text-left">
                                                <label>搜索
                                                    <input type="text" class="form-control" placeholder="客户" name="accountName" id="accountName" value="${params?.accountName}">
                                                    <input type="text" class="form-control" placeholder="所有人" name="ownerFullName" id="ownerFullName" value="${params?.ownerFullName}">
                                                </label>
                                            </div>
                                        </div>
                                        <div class="col-md-4 p-r-0 dt-buttons text-right">
                                            <button class="btn btn-inverse btn-sm btn-squeare" type="submit"><i class="fa fa-search"></i></button>
                                            <button class="btn btn-inverse btn-sm btn-squeare" type="button" id="resetBtn"><i class="fa fa-refresh"></i></button>
                                        </div>
                                    </div>
                                </g:form>

                                <table class="table table-striped  table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <g:sortableColumn property="serialNumber" title="团队的商机号"></g:sortableColumn>
                                            <g:sortableColumn property="user" title="所有人"></g:sortableColumn>
                                            <g:sortableColumn property="account" title="客户"></g:sortableColumn>
                                            <g:sortableColumn property="amount" title="金额"></g:sortableColumn>
                                            <g:sortableColumn property="probability" title="几率"></g:sortableColumn>
                                            <g:sortableColumn property="status" title="状态"></g:sortableColumn>
                                            <g:sortableColumn property="stage" title="阶段"></g:sortableColumn>
                                            <g:sortableColumn property="product" title="产品"></g:sortableColumn>
                                            <g:sortableColumn property="startTime" title="开始时间"></g:sortableColumn>
                                            <g:sortableColumn property="endTime" title="结束时间"></g:sortableColumn>
                                            <g:sortableColumn property="modifiedDate" title="更新时间"></g:sortableColumn>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <g:each in="${opportunityTeamList}">
                                            <tr>
                                                <td>
                                                    <g:link controller="opportunity" action="show" id="${it?.opportunity?.id}">${it?.opportunity?.serialNumber}</g:link>
                                                </td>
                                                <td>${it?.opportunity?.user}</td>
                                                <td>${it?.opportunity?.account}</td>
                                                <td>${it?.opportunity?.amount}</td>
                                                <td>${it?.opportunity?.probability}</td>
                                                <td>${it?.opportunity?.status?.name}</td>
                                                <td>${it?.opportunity?.stage?.name}</td>
                                                <td>${it?.opportunity?.product?.name}</td>
                                                <td>
                                                    <g:formatDate date="${it?.opportunity?.startTime}" format="yyyy-MM-dd"></g:formatDate>
                                                </td>
                                                <td>
                                                    <g:formatDate date="${it?.opportunity?.endTime}" format="yyyy-MM-dd"></g:formatDate>
                                                </td>
                                                <td>
                                                    <g:formatDate date="${it?.opportunity?.modifiedDate}" format="yyyy-MM-dd"></g:formatDate>
                                                </td>
                                            </tr>
                                        </g:each>
                                    </tbody>
                                </table>

                                <div class="dataTables_paginate">
                                    <div class="pagination">
                                        <g:paginate total="${opportunityTeamCount ?: 0}" params="${params}" />
                                    </div>
                                </div>
                            </div>

                        </div>

                    </div>
                </div>
                <!-- Hover table card end -->
            </div>

            <!-- Page-body end -->
        </div>
    </div>
    <g:javascript>
        $(function () {
        $("#resetBtn").click(function () { $("#accountName").val(""); $("#ownerFullName").val(""); }) });

    </g:javascript>
</body>

</html>
